/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'SimHei', sans-serif;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    overflow-x: hidden;
}

/* Responsive container - adapts to iframe vs full browser */
.container {
    width: 100%;
    height: 450px; /* Default iframe height */
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Full browser mode detection */
@media (min-height: 500px) {
    .container {
        height: 90vh;
    }
}

/* Story section with visual scenes */
.story-section {
    flex: 1;
    display: flex;
    background: linear-gradient(to bottom, #87ceeb 0%, #f0f8ff 50%, #ffd700 100%);
    position: relative;
    overflow: hidden;
}

.scene-container {
    flex: 2;
    position: relative;
    overflow: hidden;
}

.scene {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scene.active {
    opacity: 1;
}

/* Whale animations and styles */
.whale {
    width: 120px;
    height: 60px;
    background: #4a4a4a;
    border-radius: 50px 10px 50px 10px;
    position: relative;
    animation: breathe 3s ease-in-out infinite;
}

.whale::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 30px;
    background: #4a4a4a;
    border-radius: 0 0 20px 20px;
    top: -15px;
    right: 20px;
    transform: rotate(-20deg);
}

.whale.wet {
    background: #5a5a5a;
    box-shadow: 0 0 20px rgba(135, 206, 235, 0.7);
}

.whale.swimming {
    animation: swim 4s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { transform: scale(1) translateY(0); }
    50% { transform: scale(1.05) translateY(-5px); }
}

@keyframes swim {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(20px) rotate(5deg); }
    75% { transform: translateX(-20px) rotate(-5deg); }
}

/* Characters */
.characters {
    position: absolute;
    bottom: 20px;
    left: 20px;
}

.character {
    width: 30px;
    height: 50px;
    background: #ff6b6b;
    border-radius: 15px 15px 5px 5px;
    margin: 0 10px;
    display: inline-block;
    position: relative;
    animation: running 2s ease-in-out infinite;
}

.character::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: #ffb74d;
    border-radius: 50%;
    top: -10px;
    left: 5px;
}

@keyframes running {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Water buckets animation */
.water-buckets {
    position: absolute;
    top: 30%;
    right: 20%;
}

.water-bucket {
    width: 15px;
    height: 20px;
    background: #2196f3;
    border-radius: 0 0 8px 8px;
    margin: 5px;
    opacity: 0;
    animation: pourWater 1s ease-in-out forwards;
}

@keyframes pourWater {
    0% { opacity: 0; transform: translateY(-20px); }
    50% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0.3; transform: translateY(20px); }
}

/* Story text display */
.story-text {
    flex: 1;
    padding: 15px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    line-height: 1.6;
    overflow-y: auto;
    border-left: 3px solid #2196f3;
}

/* Discussion panel */
.discussion-panel {
    background: white;
    padding: 15px;
    border-top: 2px solid #2196f3;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* Scene navigation */
.scene-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.nav-btn {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #2196f3;
    background: white;
    color: #2196f3;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    font-weight: bold;
}

.nav-btn:hover {
    background: #e3f2fd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3);
}

.nav-btn.active {
    background: #2196f3;
    color: white;
}

/* Discussion area */
.discussion-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    min-height: 120px;
}

.question-section h3 {
    font-size: 16px;
    color: #1976d2;
    margin-bottom: 10px;
}

.question {
    display: none;
    margin-bottom: 15px;
}

.question.active {
    display: block;
}

.question p {
    font-size: 13px;
    margin-bottom: 10px;
    font-weight: bold;
}

/* Response options */
.response-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.opinion-btn {
    padding: 6px 12px;
    border: 1px solid #4caf50;
    background: white;
    color: #4caf50;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 11px;
}

.opinion-btn:hover, .opinion-btn.selected {
    background: #4caf50;
    color: white;
    transform: scale(1.05);
}

/* Care actions */
.care-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.action-item {
    padding: 8px;
    background: #f5f5f5;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 11px;
    border: 2px solid transparent;
}

.action-item:hover {
    background: #e8f5e8;
    border-color: #4caf50;
    transform: translateY(-2px);
}

.action-item.selected {
    background: #4caf50;
    color: white;
}

/* New styles for scene 2 rating options */
.rating-options {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.rating-btn {
    padding: 4px 8px;
    border: 1px solid #ff9800;
    background: white;
    color: #ff9800;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 10px;
}

.rating-btn:hover, .rating-btn.selected {
    background: #ff9800;
    color: white;
    transform: scale(1.05);
}

/* New styles for scene 3 feeling options */
.feeling-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.feeling-btn {
    padding: 6px 8px;
    border: 1px solid #9c27b0;
    background: white;
    color: #9c27b0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 10px;
    text-align: center;
}

.feeling-btn:hover, .feeling-btn.selected {
    background: #9c27b0;
    color: white;
    transform: scale(1.05);
}

/* Modified input styles for scene 3 */
.learning-input {
    width: 100%;
    height: 50px;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 6px;
    resize: none;
    font-size: 11px;
    font-family: inherit;
}

/* Suggestion input - keeping original for compatibility */
.suggestion-input {
    width: 100%;
    height: 60px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: none;
    font-size: 12px;
    font-family: inherit;
}

.submit-btn {
    width: 100%;
    padding: 8px;
    background: #ff9800;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 8px;
    transition: background 0.3s ease;
}

.submit-btn:hover {
    background: #f57c00;
}

/* Response display */
.response-display {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    border-left: 4px solid #2196f3;
}

.response-display h4 {
    font-size: 14px;
    color: #1976d2;
    margin-bottom: 8px;
}

.response-content {
    font-size: 12px;
    line-height: 1.4;
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    margin-top: 15px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #2196f3);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 2px;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
    max-width: 200px;
    word-wrap: break-word;
}

.tooltip.show {
    opacity: 1;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .discussion-area {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .scene-nav {
        flex-direction: row;
        gap: 5px;
    }
    
    .nav-btn {
        font-size: 11px;
        padding: 6px 8px;
    }
    
    .story-text {
        font-size: 13px;
        padding: 10px;
    }
    
    .response-options {
        flex-direction: column;
    }
    
    .opinion-btn {
        width: 100%;
        text-align: center;
    }
    
    .rating-options {
        flex-direction: column;
    }
    
    .feeling-options {
        grid-template-columns: 1fr;
    }
}

/* Touch-friendly interaction states */
@media (hover: none) {
    .nav-btn:active {
        background: #1976d2;
        transform: scale(0.95);
    }
    
    .opinion-btn:active {
        transform: scale(0.95);
    }
    
    .action-item:active {
        transform: scale(0.95);
    }
    
    .rating-btn:active {
        transform: scale(0.95);
    }
    
    .feeling-btn:active {
        transform: scale(0.95);
    }
}